/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.intec.matsab.persistence;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 *
 * @author Sabrina
 */
@Embeddable
public class HistorialPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "matricula")
    private int matricula;
    @Basic(optional = false)
    @Column(name = "idAsignatura")
    private String idAsignatura;
    @Basic(optional = false)
    @Column(name = "idTrimestre")
    private int idTrimestre;
    @Basic(optional = false)
    @Column(name = "numero")
    private int numero;

    public HistorialPK() {
    }

    public HistorialPK(int matricula, String idAsignatura, int idTrimestre, int numero) {
        this.matricula = matricula;
        this.idAsignatura = idAsignatura;
        this.idTrimestre = idTrimestre;
        this.numero = numero;
    }

    public int getMatricula() {
        return matricula;
    }

    public void setMatricula(int matricula) {
        this.matricula = matricula;
    }

    public String getIdAsignatura() {
        return idAsignatura;
    }

    public void setIdAsignatura(String idAsignatura) {
        this.idAsignatura = idAsignatura;
    }

    public int getIdTrimestre() {
        return idTrimestre;
    }

    public void setIdTrimestre(int idTrimestre) {
        this.idTrimestre = idTrimestre;
    }

    public int getNumero() {
        return numero;
    }

    public void setNumero(int numero) {
        this.numero = numero;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) matricula;
        hash += (idAsignatura != null ? idAsignatura.hashCode() : 0);
        hash += (int) idTrimestre;
        hash += (int) numero;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HistorialPK)) {
            return false;
        }
        HistorialPK other = (HistorialPK) object;
        if (this.matricula != other.matricula) {
            return false;
        }
        if ((this.idAsignatura == null && other.idAsignatura != null) || (this.idAsignatura != null && !this.idAsignatura.equals(other.idAsignatura))) {
            return false;
        }
        if (this.idTrimestre != other.idTrimestre) {
            return false;
        }
        if (this.numero != other.numero) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.intec.matsab.persistence.HistorialPK[matricula=" + matricula + ", idAsignatura=" + idAsignatura + ", idTrimestre=" + idTrimestre + ", numero=" + numero + "]";
    }

}
